import VueRouter from "vue-router";
import Vue from "vue";
import Home from "@/pages/Home";
import Login from "@/pages/Login";
import News from "@/pages/Home/News";
import Music from "@/pages/Home/Music";
import Game from "@/pages/Home/Game";
import NotFound from "@/pages/NotFound/404";

Vue.use(VueRouter)

const router = new VueRouter({
    mode:"history",
    routes:[
        {
            path:"/",
            redirect:"/Home"
        },
        {
            path:"/Home",
            component:Home,
            children:[
                {
                    path:"News",
                    component:News,
                    name:"News",
                },
                {
                    path:"Music",
                    component:Music,
                    name:"Music",
                },
                {
                    path:"Game",
                    component:Game,
                    name:"Game",
                },
                {
                    // 重定向
                    path:"",
                    redirect:"News"
                }
            ]
        },
        {
            path:"/Login",
            component:Login
        },
        // 404
        {
            path:"/*",
            component:NotFound
        }
    ]
})
export default router